/**
*	bootstrap button 事件公共js模块
*   @Author jackson wang
*   @date 2016-09-022
*   @version 1.0
*
*/

define(["jquery",'bsUtil'], 
	function($,bsUtil) {
	
	'use strict';
	
	
							
	var rootid = 'oa-diningapply';
	
	var rootlate = 'oa-lateformeal';
	
	var public_method = {
		initElement:function(){
			var _el =$('#'+rootid + ' #diningFee');
			if(_el.length==1){
				_el.unbind('click');
				_el.bind('click',private_method.clickEvent);
			}
		}
	}
	
	var private_method = {
		clickEvent:function(e){
			
			var _el = $(e.currentTarget);
			if(_el.length==1){
				var _ro = _el.attr('readonly');
    			if(!(typeof(_ro)=="undefined")){
    				return ;	
    			}
				var _tmp =bsUtil.sumAndMul({rootid:rootid,sumEl:['diningNum','diningByNum'],mulEl:['diningLevel']})
				if(_tmp>0)
					$(e.currentTarget).val(_tmp);
				else{
					$(e.currentTarget).val('');
				}
			}
		}
	}
	
	return public_method;
})